package com.example.springboot.demo;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.Arrays;

@Configuration
@Aspect
public class AOPConfig {
    @Around(value = "@within(org.springframework.web.bind.annotation.RestController)")
    public Object simpleAop (final ProceedingJoinPoint pjp ) throws Throwable {
            Object [] args =pjp.getArgs();
            System.out.println("args:"+ Arrays.asList(args));
            System.out.println("controller被调用");
                Object o =pjp.proceed();
                System.out.println("return"+o);
                return  o;

    }

}
